package com.fili;

import java.util.Map;
import java.util.HashMap;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * Created by Claudiu-Florin FILIMON
 * Date: Oct 24, 2006
 * Time: 10:44:01 AM
 * Revision: 0
 */
public class JadParser
{
    public static Map parseJar(String jarName)
    {
        HashMap map = new HashMap();

        try
        {
            BufferedReader br = new BufferedReader(new FileReader(jarName));

            String line;

            while ((line=br.readLine())!=null)
            {
                int p = 0;
                while ((p<line.length())&&(line.charAt(p) != ':'))
                    p++;
                String s1 = line.substring(0,p).trim();
                String s2 = line.substring(p+1).trim();
                map.put(s1,s2);
            }
        }
        catch (FileNotFoundException e)
        {
            e.printStackTrace();
            return null;
        }
        catch (IOException e)
        {
            e.printStackTrace();
            return null;
        }

        return map;
    }
}
